<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/lodash.js"></script>

  <style>
    .box {
      width: 100px;
      height: 100px;
      background: red;
    }
  </style>

</head>

<body>

  <div class="box"></div>

  <script>
    const debounceClick = _.debounce(() => {
      console.log('222')
    }, 300, {
      leading: true,
      trailing: true,
      maxWait: 1000
    })

    document.querySelector('.box').onclick = () => {
      debounceClick()
    }
  </script>
</body>

</html>